//
//  CellHeaderView.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/9.
//

import UIKit

class CellHeaderView: UIView {

    init() {
        super.init(frame: CGRect.zero)
        
        let headimg = UIImageView()
        addSubview(headimg)
        let icon = UIImageView()
        headimg.addSubview(icon)
        icon.backgroundColor = .red
        icon.snp.makeConstraints({
            $0.bottom.right.equalTo(headimg)
            $0.width.height.equalTo(headimg).dividedBy(3)
        })
        icon.layer.cornerRadius = 30/3/2
        icon.layer.borderWidth = 1
        icon.layer.borderColor = UIColor.white.cgColor
        
        headimg.backgroundColor = .blue
        headimg.snp.makeConstraints({
            $0.left.top.equalTo(15)
            $0.height.width.equalTo(30)
            $0.bottom.equalToSuperview().inset(15)
        })
        headimg.layer.cornerRadius = 15
        
        let name = UILabel()
        name.text = "天下第一"
        name.font = Font_Size_12
        name.textColor = B000_COLOR
        addSubview(name)
        name.snp.makeConstraints({
            $0.left.equalTo(headimg.snp.right).offset(5)
            $0.top.equalTo(headimg.snp.top)
        })
        let desc = UILabel()
        desc.text = "1小时前*中央电视台"
        desc.font = Font_Size_12
        desc.textColor = B999_TITLE_COLOR
        addSubview(desc)
        desc.snp.makeConstraints({
            $0.left.equalTo(headimg.snp.right).offset(5)
            $0.bottom.equalTo(headimg.snp.bottom)
        })
        let like = UIButton(type: .custom)
        like.layer.borderWidth = 0.5
        like.layer.borderColor = B999_TITLE_COLOR.cgColor
        like.layer.cornerRadius = 5
        like.setTitle("关注", for: .normal)
        like.contentEdgeInsets = UIEdgeInsets.init(top: 5, left: 10, bottom: 5, right: 10)
        like.titleLabel?.font = Font_Size_13
        like.setTitleColor(B000_COLOR, for: .normal)
        addSubview(like)
        like.snp.makeConstraints({
            $0.right.equalToSuperview().inset(15)
            $0.centerY.equalToSuperview()
        })
        like.addTarget(self, action: #selector(likethis), for: .touchUpInside)
    }
    func bind(item:NewsModel) {
        
    }
    @objc func likethis(){
        
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
